// VObject.h
//
#ifndef VOBJECT_H
#define VOBJECT_H

#include "OpenGL/Box.h"
#include "OpenGL/Color.h"

#include <string>
#include <vector>

namespace OpenGL {
	class Renderer;
}


class VObject
{
public:
	enum ObjectType { None, Point, Line, PolyLine, Shape, Unknown };

protected:
	unsigned int       _id;
	std::string        _name;
	OpenGL::Math::box3 _boundingBox;
	OpenGL::Color      _color;

	bool               _selected;
	bool               _hilighted;
	bool               _visible;

	static OpenGL::Color  _selectionColor;
	static OpenGL::Color  _hilightColor;
public:
	static void setSelectionColor( const OpenGL::Color &c );
	static void setHilightColor( const OpenGL::Color &c );

	VObject();
	virtual ~VObject() {}

	void setName( const std::string &name );
	void setSelected( bool on );
	void setHilighted( bool on );
	void setColor( const OpenGL::Color &c );


	unsigned int id() const;
	std::string name() const;
	bool isSelected() const;
	bool isHilighted() const;
	bool isVisible() const;
	OpenGL::Math::box3 boundingBox() const;
	virtual OpenGL::Math::dvec3 textPosition() const = 0;
	virtual std::vector<OpenGL::Math::dvec3> snapPoints() const = 0;

	OpenGL::Color color() const;
	
	virtual ObjectType type() const ;
	virtual void draw( OpenGL::Renderer *r )const;
	virtual void drawForSelection( OpenGL::Renderer *r )const;
	virtual bool intersects( const OpenGL::Math::box3 &b )const;
};

#endif